package com.xnyzc.lhy.mis.controller.cmsapi.workorder;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.param.worksheet.WorkSheetGetByConditions;
import com.xnyzc.lhy.mis.entity.worksheet.OaCWorkOrder;
import com.xnyzc.lhy.mis.service.worksheet.IWorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 工单
 *
 * @author zhaolijie
 * @date
 */
@RestController
@RequestMapping(value = "/cms/CmsWorkOrder")
public class CmsWorkOrderController {
    @Autowired
    private IWorkOrderService workOrderService;

    /**
     * 条件查询工单列表
     */
    @PostMapping(value = "/exportWorkOrder")
    public void exportWorkOrderByConditions(@RequestBody WorkSheetGetByConditions conditions){
        workOrderService.exportWorkOrderByConditions(conditions);
    }

    /**
     * 条件查询工单列表
     */
    @PostMapping(value = "/getWorkOrderList")
    public Rv getWorkOrderListByConditions(@RequestBody WorkSheetGetByConditions conditions){
        return workOrderService.getWorkOrderListByConditions(conditions);
    }

    /**
     * 新增工单信息
     */
    @PostMapping(value = "/addWorkSheetInfo")
    public Rv addWorkSheetInfo(@RequestBody OaCWorkOrder oaCWorkOrder){
        return workOrderService.addWorkSheetInfo(oaCWorkOrder);
    }

    /**
     * 撤销工单信息
     */
    @PostMapping(value = "/revokeWorkSheet")
    public Rv revokeWorkSheetInfo(@RequestBody OaCWorkOrder oaCWorkOrder){
        return workOrderService.revokeWorkSheetInfo(oaCWorkOrder);
    }

    /**
     * 根据订单号查询工单信息
     */
    @GetMapping(value = "/getWorkSheetByOrderNo")
    public Rv getWorkSheetByOrderNo(@RequestParam String orderNo){
        return workOrderService.getWorkSheetByOrderNo(orderNo);
    }
}
